Search

Search

Search for
By user

Posts with 'akenes anodynic reverse':


Did you mean kraaled?

User
Reverse cowgirl
n

Nancy Drew and the Mystery of Reverse Cowgirl.
I checked my son’s browser history. Found links about reverse cowgirl. Should I talk to him?
Are you there God? It’s me, reverse cowgirl.
Reverse cowgirl gets me into some awkward situations. But I won’t stop.
My car looks like it’s reverse cowgirl but I don’t mind. It gets me from point A to point B.
Our secret society is dedicated reverse cowgirl.

User
OK. Here's what I've come up with so far. It's a work in progress but I need somewhere to update/amend it.

Things that are the same should look the same. Things that are different should look different.

Not helping is better than pretending to help.

Pick something! Establish conventions for meaningless decisions. Letting people make meaningless decisions is not "freedom."

Design for people, not for tools. If it is clear and unambiguous to a human then the same can be true for tools. But the reverse is not true.

The freedom to do cool things is less important than the freedom to not have to do sucky things.

Consistency is more beautiful than beauty.

Abstractions are expensive and confusing, pretty much by definition. Only abstract when the payoff is big enough.
User
SRAW said:
I hate halloween too, tons of kids came to my house and my sister had to stand at the door saying TRICK OR TREAT while I was hiding and sulking in my bedroom, to hide from the kids of course


I still want to know why your sister was saying trick or treat. Reverse Halloween?

Also this is kind of sad. Me and AaronJer used to have tons of fun scaring the kids who came to the door. You are missing out.
Truck
User
SuperJer said:
I don't know the answers. All I would do is guess and check until it works. But it's your map, so you do it!

There should be options in the entity for "reverse direction", "x axis" and "y axis". Try changing those to get it to do what you want.

Ok, Now I have another thing: In wally program, I want to create wad file that contains my texture:
1/ I have 2 photos. One of them, when I do 'paste as new' and write name of texture, the photo comes without colors or very ugly. Solution?
2/ the second photo it pastes normally, but when I add the wad file to hammer and add the texture and export and enter cs to play the map, the loading blocks at 'starting local game server'. Solution plz?













____________________________________________________________
EDIT:
How can I make my own sky to put it in my map? tell me plz
Truck
User
I don't know the answers. All I would do is guess and check until it works. But it's your map, so you do it!

There should be options in the entity for "reverse direction", "x axis" and "y axis". Try changing those to get it to do what you want.
User
Mate de Vita said:
Have you tried Tools > Options > 3D Views > General > Reverse Selection Order?


Yeah,it didn't change anything.It's ironic because when I didn't have any drivers installed I could select stuff more precisely.
Have you tried Tools > Options > 3D Views > General > Reverse Selection Order?
User
Java apparently has some security problems.

Reverse TCP Connection. Sounds scary. I'm scared. Should I be scared?

Also, have a Swedish link.
User
You don't need a domain but it helps if your reverse DNS is correct. (It can be a subdomain.)
Truck
User
buq25 said:
Blood+

For merely mentioning Blood+ and not Blood: The Last Vampire, you're going to get hell from aaronjer. I saw them in reverse order and I was okay with Blood+, mostly, but it got to the point where I realized that none of the scene-setting shit mattered and that the peripheral characters were all but disposable. That's not something that makes me happy.

Among the shows I would give some praise of but not fully endorse (it seems like you're well-versed in the Adult Swim stuff):

Ghost Hound - Takes place in a small Japanese town with primary characters of a brewer's son who was kidnapped as a child along with his sister (who died), a somewhat smarmy scientist's son from Tokyo who has a crippling fear of heights, the guitar-playing, ne'er-do-well grandson of a local cult leader (whose family was rumored to be involved with the kidnapping of kid #1), and the daughter of a local priest who is sometimes possessed/has visions. It's a decent premise rooted somewhat in the spirit world and self-exploration with questions of technology and the human soul, but the last few episodes shit the bed and they forget about the driving forces of the plot in favour of some other stupid bullshit.

Black Butler - Basic premise: Victorian era nobleman's son witnesses parents killed off by some cultish thing and then contracts with the devil to be his butler in exchange for his soul later. There are also the goofy side characters of the pyromaniac chef, the absurdly strong but clumsy gardener, the near-sighted maid, and the usually chibi old butler, none of whom are exactly what they seem. It's mostly humourous, but dark humour, mixed with the occassional feat of badassery from the butler. If you get into it, I wouldn't watch the second series, it's not nearly as good.

D. Gray Man - It's a shounen, so you have to deal with certain shounen tropes, but it has a driving force behind it that is a lot weirder and scarier than most shows will go to. In the world, there are akuma, or demons. These demons come out in a very particular way. First, someone dies. Then someone close to them, lamenting that death, contracts with the series' villain (a particularly goofy looking gentleman) to bring them back. The soul of the deceased is then transfered to large black skeleton where it is trapped, and the soul, no longer capable of controlling its own actions but remaining aware of them, kills the person that brought them back and wears their skin. Those are the akuma. There are various evolutions of each akuma which only corrupt the soul more and more, but that's the gist of it. Exorcists fight them. One of them has a big punchy hand and then there's a samurai and a girl who kicks stuff. They aren't quite so interesting as the akuma and the people controlling the akuma, but at the very least, they manage to give the main characters development. The shit thing about the show is that it follows a manga and the mangaka is frequently sick/injured/loony and production has become erratic, which means that the show went to an anime-only conclusion where the manga is still rolling (and has just recently revealed all of the players on the evil side). But when it's funny/silly, it's super silly, and when it's uncomfortable, it's super bleak.

Samurai 7 - Based off the Kurosawa flick, if you make the world not feudal Japan but some grey wasteland with pockets of dense industrial cities, if you make the raiders evil aliens with space ships, and if you give the titular samurai anime type martial arts superpowers. It's fucking pretty but I've never seen it in its entirety.

Last Exile - Steampunky, lots of air fights, weird world (kingdoms fighting each other, separated by giant storm fields), but ultimarely falls apart at the end like Ghost Hound does and fails to be as interesting as it seemed like it wanted to be. BUT THEY'RE MAKING A NEW SERIES.

Pani Poni Dash - Uhhh.... seen Azumanga Daioh? It's like that. But faster. And usually weirder. God is a cat that lives in vending machines and warms things up to his body heat.

Excel Saga - Also fucking weird. Just watch it. Nabeshin!
User
FWIW here's how I would write the sorting program you described in the OP with just one compare function.

I think it works, too! It's intended to be simple, not that fast.

Also I just fixed the forams bug where [] tags inside the [code] tags were getting interpreted as special.

C code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

#define MAXLINES 100
#define MAXLEN 1000

static int numsort, reverse, folding, dicsort;


int compar(const void *_a, const void *_b)
{
const char *a=*(char * const *)_a;
const char *b=*(char * const *)_b;
int diff = 0;

if( numsort )
diff = atoi(a) - atoi(b);
else if( dicsort )
while( !diff && (*a || *b) ) {
while( *a && !isalnum(*a) && !isspace(*a) ) a++;
while( *b && !isalnum(*b) && !isspace(*b) ) b++;
diff = folding ? tolower(*a) - tolower(*b) : *a - *b;
if( a ) a++;
if( b ) b++;
}
else
diff = folding ? strcasecmp(a,b) : strcmp(a,b);

return reverse ? diff*-1 : diff;
}


int main(int argc, char *argv[])
{
char buf[MAXLEN+1] = {'\0'};
char *lines[MAXLINES];
int count;
int i;
char *p;

// read cmd line arguments
for( i=1; i<argc && argv[i][0]=='-'; i++ )
for( p=argv[i]+1; *p; p++ )
switch( *p ) {
case 'n': numsort = 1; break;
case 'r': reverse = 1; break;
case 'f': folding = 1; break;
case 'd': dicsort = 1; break;
default: goto bad_arg;
}

// read all input lines
for( count=0; fgets(buf, MAXLEN+1, stdin); count++ ) {
if( count>=MAXLINES ) goto too_many_lines;
if( buf[MAXLEN-2] ) goto too_long;
lines[count] = malloc(strlen(buf)+1);
strcpy(lines[count], buf);
}

// sort, print the results, deallocate
qsort(lines, count, sizeof *lines, compar);
for( i=0; i<count; i++ ) {
printf("%s", lines[i]);
free(lines[i]);
}

exit(EXIT_SUCCESS);

bad_arg: fprintf(stderr, "Bad arg: -%c\n", *p); exit(EXIT_FAILURE);
too_long: fprintf(stderr, "Line too long\n" ); exit(EXIT_FAILURE);
too_many_lines: fprintf(stderr, "Too many lines\n" ); exit(EXIT_FAILURE);
}
Down Rodeo said:
Re: sorting, sort once then reverse if needed?

That's how I first did it, but you need two functions for that as well, and the lines have to go through both if -r flag is used.

Anyway, the next exercise reads:

Exercise 5-14. Add a field-handling capability, so sorting may be done on fields within lines, each field according to an independent set of options. (The index for this book was sorted with -df for the index category and -n for the page numbers.)

I'm guessing this means that
code
./LineSort.out -df 4 -n 2 -r
would sort the entire file with the option -df, then sort the words (ie. sets of characters separated by spaces) in the 4th field of each line numerically and the words in the 2nd field of each line in reverse lexicographical order.
How would I define a field though?

In the book's index a line looks like this:
code
array, storage order of 104, 210

The first field is 'array, storage of', the second field is '104, 210'. So I guess a field is defined as a set of characters that's separated from the rest by more than a single space. Or maybe that's a tab in between.
User
And that is why C can quite often scare me. Re: sorting, sort once then reverse if needed? I'd need to sit and have a look but the style of C you're using is slightly different to what I've seen so some things don't make sense to me so much :p
New exercise from K&R, a program that sorts input lines in lexicographical order. It also allows a couple of flags that affect the comparing and the sorting part of the program.
It's an exercise that supposedly shows the usefulness of function pointers.

C code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAXLINES 100
#define MAXLEN 1000

int main(argc, argv)
int argc;
char *argv[];
{
char *lineptr[MAXLINES];
int nlines;
int strcomp(), numcomp(), dictcomp(), foldcomp(), dfcomp(), swap(), linesort(), revsort();
int (*cmpfunc)() = strcomp, (*sortfunc)() = linesort;
char *flag;
int fold = 0, dict = 0;

while (--argc > 0 && (*++argv)[0] == '-')
for (flag = argv[0] + 1; *flag != '\0'; flag++)
switch (*flag){
case 'n':
cmpfunc = numcomp;
break;

case 'r':
sortfunc = revsort;
break;

case 'f':
fold = 1;
break;

case 'd':
dict = 1;
break;

default:
printf ("Illegal option: -%c.\n", *flag);
break;
}
if (dict || fold){
if (dict && fold) cmpfunc = dfcomp;
else if (dict) cmpfunc = dictcomp;
else cmpfunc = foldcomp;
}

if ((nlines = readlines (lineptr, MAXLINES)) >= 0){
(*sortfunc) (lineptr, nlines, cmpfunc, swap);
writelines (lineptr, nlines);
}

else if (nlines == -1) printf ("Input too big to sort: too many lines.\n");
else if (nlines == -2) printf ("Input too big to sort: not enough room in allocbuf.\n");
else printf ("Input too big to sort - line too long.\n");

return 0;
}


That's the main part of the program (the whole thing is quite a bit longer due to the number of functions required).



The flags are as follows:

-n : Program sorts lines in numerical order from the lowest number to the highest. This flag was added in the book already, the rest were incorporated by me as a part of the exercise.
-r : Program sorts lines in reverse. This flag has to work in conjunction with any of the other flags.
-f : Program folds upper and lower case together.
-d : Program sorts lines in dictionary order (makes comparisons only on letters, numbers and blanks). It has to work with the -f flag.



The functions are:


strcomp() compares two lines and returns 0 if they are the same, a positive int if the first one is lexicographically larger (ie. if it comes after the second one in the alphabet), and a negative int if the first one is lexicographically smaller.
This function's pointer is passed as an argument to sortfunc if no flags that would change the comparison process are in effect.

numcomp() compares two lines numerically and returns 0 if the two numbers are the same, 1 if the first number is larger, and -1 if the second number is larger.
This function's pointer is passed as an argument to sortfunc if -n flag is in effect.

dictcomp() compares two lines lexicographically, but based only on numbers, letters and blanks, and returns the same as strcomp().
This function's pointer is passed as an argument to sortfunc if -d flag is in effect.

foldcomp() compares two lines lexicographically, but it doesn't make distinctions between upper and lower case letters, so that a and A appear adjacent, returning the same as strcomp().
This function's pointer is passed as an argument to sortfunc if -f flag is in effect.

dfcomp() combines dictcomp() and foldcomp(), returning the same as strcomp().
This function's pointer is passed as an argument to sortfunc if -df (or -d -f) flags are in effect.



linesort() sorts lines by comparing two lines, using the comparison function, the pointer to which was passed to it as an argument, and sorting them with shellsort from lowest to highest.
This function is used as sortfunc if no flags that would change the sorting process are in effect.

revsort() sorts lines in the same way as linesort(), except that it sorts them from highest to lowest.
This function is used as sortfunc if -r flag is in effect.



readlines() records the lines into allocbuf, using alloc() (also a function from K&R) and returns the number of lines (or a negative int if there is an error).

writelines() outputs the lines, after they have been sorted with sortfunc.



Now the program as I made it, works as it should, but I think it's way too complicated. It has way too many functions, and the fact that I had to make a whole new function just to incorporate support for a combination of two already existing flags (-d and -f), bothers me a bit.

I'd rather just use a few external variables (dict, num, rev, fold), initialize them to 0, and set them to 1 if their respective flags were used. Then I'd just use one comparison function and one sorting function, and change the proper parts of them to behave appropriately if any of the above external variables were non-zero.
Or is there some reason why using so many functions and passing them via pointers is a good idea?
I located (one of) the problem(s) in my Reverse Polish Calculator, it's my power function. For some reason it does some really weird stuff. Here's its code in a test program (with a few added printf tests):

C code
#include <stdio.h>
#include <stdlib.h>

int main()
{
double power();

printf ("%f\n", power (10, 1));
}

double power (b, exp) //integer exponents
int exp;
double b;
{
int i, sign = 1;
double p = 1;

printf ("%f, %d\n", b, exp);

if (exp < 0){
sign = -1;
exp = -exp;
}
printf ("%d, %d\n", sign, exp);

for (i = 0; i < exp; i++) p *= b;
printf ("%f\n", p);

return ((sign == 1) ? p : 1/p);
}

This returns the following:
Terminal code
0.000000, 134513883
1, 134513883
0.000000
0.000000

As you can see, the base is read as 0 and the exponent is read as 134513883.
Why doesn't it properly read the base and the exponent?

EDIT: nvm, problem resolved. The base is a double, I input it as an integer -_-



Now only the multiplication part causes problems. It prints out a lot of Illegal option messages with some random letters. Is the * character reserved for something?
If I use another character (x for example), it works properly.
Down Rodeo said:
Unless you mean how do you pass numbers to *your* program, in which case you do it just by writing the numbers in, separated by spaces. The console just passes your program exactly what the end user types. Well, separated into strings, but you get what I mean.

superjer said:
1) Linux terminal arguments:

That's the way to do it. I'm not sure what's wrong, but here's a simple program to test it: [...]

I tried to run the add program (in my case it's called Reverse Polish.out) with the line
"./Reverse Polish.out" 2 3 +
but it just drew up a new terminal line.

I'll run that test program when I get home.

superjer said:
Are you intending to ++ argv in the first case only?

Yes, because the program accepts the following inputs:
- detab 7 5 5 5
- detab 7 +5
- detab

So if an argument consists of only a number, it should go to the next argument. If not, it should stay at the same one.

superjer said:
You shouldn't really be ++ing argv at all, I don't think. It won't blow up or anything but once you've modified it you can't go back.

Well, I have the pointer *argvstart to save the initial position of argv. Won't that work?
A few new programs (I'll just paste them here so they're all in the first post):

Exercise 5-7. Write the program add which evaluates a reverse Polish expression from the command line. For example,
add 2 3 4 + *
evaluates 2 x (3+4).


C code
#define NUMBER '0'

int main (argc, argv)
int argc;
char *argv[];
{
double op, strtofloat(), pop(), push();

while (--argc > 0)
switch (type (*++argv)){ //determines whether the next argument is a number or something else

case NUMBER: //if it's a number, it pushes it onto the stack
push (strtofloat (*argv));
break;
//otherwise it does the appropriate operation, and pushes the result onto the stack
case '+':
push (pop() + pop());
break;

case '*':
push (pop() * pop());
break;

case '-':
if (type (*argv + 1) == NUMBER){ //unary minus
push (strtofloat (*argv));
break;
}
op = pop();
push (pop() - op);
break;

case '/':
op = pop();
if (op != 0.0) push (pop() / op);
else printf ("\nZero divisor popped.\n");
break;

case '%':
printf ("\nThe floating points will be truncated for the modulus operation.\n");
op = pop();
if (op != 0.0) push ((int)pop() % (int)op);
else printf ("\nZero divisor popped.\n");
break;

default:
printf ("Illegal option: %c.\n", type (*argv));
break;
}
printf ("\t%f\n", pop());
return 0;
}

#define MAXVAL 100 //max depth of val stack

int sp = 0; //stack pointer
double val[MAXVAL]; //value stack

double push (f) //push float onto the value stack
double f;
{
if (sp < MAXVAL) return (val[sp++] = f); //if there is room on the stack push float onto the stack

printf ("Error: stack is full.\n"); //if the stack is full clear stack and return 0
clear();
return 0;
}

double pop() //pops the top value from the stack
{
if (sp > 0) return (val[--sp]); //if there are values on the stack, pop the top one
return 0; //if stack is empty return 0
}

clear() //clears stack
{
sp = 0;
}


Exercise 5-8. Modify the programs entab and detab [...] to accept a list of tab stops as arguments. Use the normal tab settings if there are no arguments.
http://users.powernet.co.uk/eton/kandr2/krx1.html
See exercises 20 and 21 for an explanation of what entab and detab do.

Exercise 5-9. Extend entab and detab to accept the shorthand
entab m +n
to mean tabs stops every n columns, starting at column m. Chooose convenient (for the user) default behavior.


detab:
C code
#define TABSTOP 5 //default length between two tab stops
#define MAXLINE 1000 //maximum line length

int main (argc, argv)
int argc;
char *argv[];
{
char *argvstart = argv;
char line[MAXLINE];
char *pline;
int col; //current column number
int nextstop; //column number of the next tab stop

while (lineget (line, MAXLINE) != 0){ //get next line
argv = argvstart; //set argv back to the first argument
nextstop = (strtoint (*++argv) > 0) ? strtoint (*argv++) : TABSTOP; //find the first tab stop
for (pline = line, col = 1; *pline != '\0'; pline++){
while (col >= nextstop) //if a tab stop has been reached, find the next one
nextstop += (strtoint (*argv) > 0) ? strtoint (*argv++) : (*argv[0] == '+') ? strtoint (*argv + 1) : TABSTOP;
if (*pline == '\t') //if the character is a '\t', print enough ' ' characters to reach the next tab stop
while (col < nextstop){
putchar (' ');
col++;
}
else { //otherwise print the character
putchar (*pline);
col++;
}
}
}
return 0;
}

int lineget (ps, lim)
char *ps;
int lim;
{
int c;
char *start = ps;

while ((c = getchar()) != EOF){
if (--lim < 1){ //line is too long, skip rest of the line
*--ps = '\n';
*++ps = '\0';
return -1;
}
*ps++ = c;
if (c == '\n') break;
}
*ps = '\0';
return (ps - start); //line length counting '\n', but not '\0'
}

int strtoint (ps)
char *ps;
{
int n = 0, sign = 1;

while (*ps == ' ' || *ps == '\n' || *ps == '\t') ps++;
if (*ps == '-'){
sign = -1;
ps++;
}

while (*ps >= '0' && *ps <= '9') n = 10 * n + *ps++ - '0';
return (sign * n);
}


entab
C code
#define TABSTOP 5
#define MAXLINE 1000

int main (argc, argv)
int argc;
char *argv[];
{
char *argvstart = argv;
char line[MAXLINE];
char *pline;
int col; //column number
int nextstop; //column number of the next tab stop
int nspaces; //total number of consecutive spaces
int ntabs; //number of consecutive spaces covered by tabs

while (lineget (line, MAXLINE) != 0){
argv = argvstart;
nextstop = (strtoint (*++argv) > 0) ? strtoint (*argv++) : TABSTOP;

for (pline = line, col = 1; *pline != '\0'; col++){
for (ntabs = nspaces = 0; *pline == ' '; nspaces++, pline++){ //count the total number of consecutive spaces
col++;
if (col >= nextstop){
putchar ('\t');
ntabs += (strtoint (*argv) > 0) ? strtoint (*argv) : (*argv[0] == '+') ? strtoint (*argv + 1) : TABSTOP; //count the number of spaces that are covered by '\t' characters
nextstop += (strtoint (*argv) > 0) ? strtoint (*argv++) : (*argv[0] == '+') ? strtoint (*argv + 1) : TABSTOP;
}
}

while ((--nspaces) % ntabs > 0) putchar (' '); //print the remaining blanks
putchar (*pline++); //print the non-blank character

while (col >= nextstop)
nextstop += (strtoint (*argv) > 0) ? strtoint (*argv++) : (*argv[0] == '+') ? strtoint (*argv + 1) : TABSTOP;
}
}
return 0;
}


1) In the linux terminal, how do I run a program with arguments? Running it as
code
./blah.out -flag1 argument
doesn't seem to work.

2) Could someone check the syntax of the lines that increment nextstop and ntabs for me? I'm pretty new to these pointers to arrays of pointers to strings. Also the conditional expressions or whatever they're called (the ?: expressions).
C code

nextstop += (strtoint (*argv) > 0) ? strtoint (*argv++) : (*argv[0] == '+') ? strtoint (*argv + 1) : TABSTOP;

This is supposed to do the following:
- if the argument is a number, it increments nextstop by that number
- if the argument is a number with a + as the first character (see Exercise 5-9), it also increments it by that number
- if there is no argument, it increments nextstop by the default length between tab stops (I used 5 as the default).

3) Did I understand the instructions correctly? For exampe, which would be the proper input if you wanted tab stops at columns 5, 12, and 16:
entab 5 7 4
or
entab 5 12 16
I went with the first one in my programs.
User
Mate de Vita said:
Btw, can *start = *start + 1 be written instead as (*start)++ ?

Yes.

Mate de Vita said:
Still, is there a better, more general solution to this problem? For example, what happens if I have to implement this into a different function where the above is possible?

I would skip forcing n to be positive, and just do the loop regardless of the sign, using absolute value:
C code
itoa (n, ps)
char *ps;
int n;
{
int i = 0, sign = n; //!
char *start = ps;

do {
*ps++ = abs(n % 10) + '0'; //!
} while (n /= 10); //!

if (sign < 0) *ps++ = '-';
*ps = '\0';

reverse (start);
}

In C the sign of the result of % with negative number(s) is implementation-defined, though, so this isn't perfect. On some systems, -13 % 10 equals 7, which would give the wrong answer. I guess to be really safe, you have to do this:

C code
itoa (n, ps)
char *ps;
int n;
{
int i = 0, sign = n, digit; //!
char *start = ps;

do {
digit = n % 10; //!
if (sign < 0 && digit > 0) digit -= 10; //!
*ps++ = abs (digit) + '0'; //!
} while (n /= 10);

if (sign < 0) *ps++ = '-';
*ps = '\0';

reverse (start);
}


Here's my test code BTW:
C code

#include <limits.h>
#include <stdio.h>

...

main()
{
int i;
char s[100];

itoa ( INT_MIN , s ); printf ("%s\n",s);
itoa ( INT_MIN+1, s ); printf ("%s\n",s);
for (i = -12; i <= 12; i++) {
itoa ( i, s ); printf ("%s\n",s);
}
itoa ( INT_MAX-1, s ); printf ("%s\n",s);
itoa ( INT_MAX , s ); printf ("%s\n",s);
}
superjer said:
You know there's a 2nd edition of K&R, right?

I saw on wikipedia, yes. But I only have this one and can't be assed to search for an online version.

New problem, I have the function itoa (n, s), which turns an integer into its decimal string representation (so the number 123 becomes a char array with the elements '1', '2', '3', '\0').

C code
itoa (n, ps)
char *ps;
int n;
{
int i = 0, tf = 0, sign;
char *start = ps;

if (n == -n && n != 0) n++, tf++; //!
if ((sign = n) < 0) n = -n;

do {
*ps++ = n % 10 + '0';
} while ((n /= 10) > 0);

if (sign < 0) *ps++ = '-';
if (tf) *start = *start + 1; //!
*ps = '\0';

reverse (start);
}


Notice the lines marked with exclamation marks, those are the ones I added myself (the rest was copied from the book). The Exercise reads:

Quote:
Exercise 3-3. In a 2's complement number representation, our version of itoa does not handle the largest negative number, that is, the value of n equal to -(2^(wordsize-1)). Explain why not. Modify it to print that value correctly, regardless of the machine it runs on.


The problem here is the process by which the computer calculates the negative number: by calculating its binary complement and incrementing it by one. In the case of -(2^(wordsize-1)), this becomes C(10000...)+1, which is 01111...+1, which in turn is again 10000..., so you get the same number.

My solution works in this case but it's rather clumsy. If the number in question ended in a 9, I would have to make *start = '0' and *(start+1)++, and so on until the end of the string. Now obviously, in this particular case this isn't a problem, since 2^n, where n is an integer, can never end with a 9.

Still, is there a better, more general solution to this problem? For example, what happens if I have to implement this into a different function where the above is possible?

Btw, can *start = *start + 1 be written instead as (*start)++ ?
User
Mate de Vita said:
EDIT: Done, here it is:
C code
reverse (ps)
char *ps;
{
char temp;
char *end = ps + strlen (ps) - 1;

while (ps < end){
temp = *ps;
*ps++ = *end;
*end-- = temp;
}
}


See, that's a good solution. You can turn any loop into recursion but it's not generally helpful.

I guess it's an OK exercise. But I think it would be better with a problem where recursion makes things a lot easier, not harder.
superjer said:
You don't need to worry about changing ps because it won't affect where it is pointing in the outer calls to the function.

Go ahead and mess with it all you want.

Oh OK, that's good then.

superjer said:
Do you have to use recursion for this? This is a really bad use of recursion. It adds a lot of confusion and complexity for nothing.

Well, there was an Exercise that required that I make a version of reverse (s) using recursion (this was before I even got to pointers). I didn't really know how else I would go about doing that.
Now I just took that same routine and replaced the strings and string indexes with pointers.
I guess I could just go ahead and write a new function from scratch.

EDIT: Done, here it is:
C code
reverse (ps)
char *ps;
{
char temp;
char *end = ps + strlen (ps) - 1;

while (ps < end){
temp = *ps;
*ps++ = *end;
*end-- = temp;
}
}


superjer said:
And is there a reason you are using the ancient 1978 style argument lists?

Not quite sure what you mean by that (unless you mean that I declare the variables separately, not in the argument list), but anyway, I'm learning C with K&R's book, which is about that age.


P.S. I'm quite bad at programming terminology, so you have to excuse me if I use some terms improperly. What's the difference between a routine, a subroutine, a procedure, a method, and a function?
User
You don't need to worry about changing ps because it won't affect where it is pointing in the outer calls to the function.

Go ahead and mess with it all you want.

Do you have to use recursion for this? This is a really bad use of recursion. It adds a lot of confusion and complexity for nothing.

If you must use recursion, you should just pass along the end pointer or the length. It's not really "recursion" if you have global variables. This would make a lot more sense:

C code
void reverse( char *start, char *end );


Then if you want to make the initial invocation simpler, just make another function with only the start and have it call reverse( start, start+strlen(start) )

And is there a reason you are using the ancient 1978 style argument lists?
I have an array indexing version of the function reverse (s) that reverses the characters in the string s (skipping the \0 at the end) and puts a new \0 at the end of resulting string s.
Now I have to change it into a pointer version. This is what I get:
C code
reverse (ps)
char *ps;
{
static char *ps1 = ps, *ps2 = ps; //this is line 57
int c;

if ((c = *ps1++) != '\0') reverse (*ps);
if (c != '\0') *ps2++ = c;
*ps2 = '\0';
}

Now, obviously this isn't right, and it returns the error:
AtoI, ItoA.c:57: error: initializer element is not constant
AtoI, ItoA.c:57: error: initializer element is not constant

The problem is that in the array version I used a static int i1 and i2, and used them as indexes of the string s.
Now I have to somehow initialize the two internal pointers to ps, so that I can reverse the string without changing where ps is pointing to, but I have to only do it once, not every time the function is called, otherwise the recursion won't work properly.

Is there a workaround for this, or do I have to make a completely different function?
User
does have zhlt some reverse???
Truck
User
Banhammar squared! That one is also interesting, but I guess it's something to do with the "reverse direction of words" option thingy.
User
Mate de Vita said:
It's a part of a Reverse Polish Notation Calculator.

That's right, those Polishess's people always think they're smart. Inventing fancy computin' machines.

wtf!?!?! Quote's fucked up.... :S
This is taken directly from the book by which I'm learning C. It's a part of a Reverse Polish Notation Calculator.

The getop() gets the next operand - it transforms a string representing a number into a number and returns it, or (if the operand is not numerical, such as +, -, a, b, etc.) returns the operand.

getch() and ungetch(c) are two functions that are used because getop() can't know it's read enough until it's read one (or possibly more) character too many. That's why the last read character (or more if it's possible) has to be pushed back to the input, so it can be read again.

Something like that.
Truck
User
You shouldn't be using those two functions together like that. If you do, you need to decode/unescape them in the reverse order. But I don't see the point.

If you need html encoding and mysql escaping then you probably need 2 separate variables like $htmlValue and $sqlValue for instance. The 1st for display and the second for use in SQL queries.
Truck
User
It doesn't always give you a squiggly. I've seen the reverse squiggly, one of the L-blocks, and several line pieces. I haven't seen the square or the T-block yet though.

I was playing it last night while I was drunk and got three lines in a game at one point. I don't know why it came back, but someone probably discovered it somewhere and posted about it and it kept ballooning from there.
User
sprinkles said:
Rockbomb said:
sprinkles said:
Rockbomb said:
Here's the link to the start button changer. You can use the ones that come with it, or you can look on DA for some more.
http://kishan-bagaria.deviantart.com/art/Windows-7-Start-Orb-Changer-v3-153001999


Did you get an error?

code
System.ArgumentException: Procedure call or argument is not valid.



I hit continue and it still worked but...

Yeah I got the error too, but it worked so I didn't give a shit xD



It makes me want to see the source code (because its .net).

Reverse engineer it ;)
kitaramies94 said:

And yeah with me it also selects some big object behind what I'm trying to select.


In Hammer: "Tools" --> "Options..." --> "3D views" and make sure "Reverse selection order" is not checked.

(If it's already unchecked you could try checking it and see if that helps...)
User
Down Rodeo said:
I find English to be a very interesting language simply for the vast number of influences it has had on it. And I know what you mean NatureJay, every day I spend on the internet makes me feel that little bit more stupid. I've taken up reading again in an attempt to reverse the trend (it's surprising, since I did I've noticed my spelling, once pretty damn good, latterly a bit more crap, pick up again). That was a tortuous parenthetic statement, wasn't it?


I recall with some astonishment when I learned that I was the only student in my English class (during my High school / community college days) that didn
User
I find English to be a very interesting language simply for the vast number of influences it has had on it. And I know what you mean NatureJay, every day I spend on the internet makes me feel that little bit more stupid. I've taken up reading again in an attempt to reverse the trend (it's surprising, since I did I've noticed my spelling, once pretty damn good, latterly a bit more crap, pick up again). That was a tortuous parenthetic statement, wasn't it?
User
So I've been decided on making a motorcycle and I wanted to use track train cause I heard its very simple to use, but all efforts have failed. I set the path track names to "s0" "s1" "s2" "s3", and I checked maybe 7 times if the paths lead to each other and spelled correctly. I made sure the train speed was 200 and the intial speed was 200. The motorcycles Global name is motorcycle and its func is tracktrain, not sure if it matters the target name is motorcycle.I mean why would they give tracktrain 2 names, a global and a target name... but anyways everything is flawless and the postions of the path_tracks are above ground and in good spots, yet it does not move... the controls work for the drive speed and reverse, but it wont move could someone help me with this? I searched the forums but nothing is close to my problem (alot of people use func_train and not tracktrain).
the_cloud_system said:
how do i make light_envirment light everey thing

Just make the sky across the whole map and put 1 light_environment environment anywhere in the map.

the_cloud_system said:
how do i make func_rotating work to go clockwise

If it goes counter-clockwise normally then just check the Reverse direction flag.

the_cloud_system said:
and how to trigger it

Just give it a name and then target it with e.g. func_button.

the_cloud_system said:
info_teleport_destination am i going to wright it from scrach

What?
User
Quote:
"Tools" ---> "Options..." ---> "3D views" and uncheck "Reverse selection order". That should take care of the selection-problem


I did this and it still happens.

I can't find myself mapping for more than an hour coz it takes me about an hour just to select a brush to align the textures but eventually I run out of patience and then kick the PC pff the desk, so can anyone help me before I end up buying another new PC ?
Farmboy102 said:
Ok I noticed on team fortress that some items can only be picked up by certain teams now how can I do this in CSCZ.

I don't know very much about CSCZ-mapping but I don't think you can do this through mapping, but maybe by coding a plugin.

Farmboy102 said:

I want to make a mounted machine gun that can only be used by the terries , now I got a new PC ( Finally now I can make Bigger maps than usual ) and I forgot to backup all my previous data so I have to start mapping all over again now I remember most of the stuff , But I need some tutorials again, I also need the content for the .bat file I kinda forgot that.

Read superjers tutorials? http://www.superjer.com/learn.php

Farmboy102 said:

I also need a tutorial for a mounted machine gun coz I can't remember where I found my previous tutorial. ( It feels like I've got amnesia. )

Maybe this?

Farmboy102 said:

Then there is another weird thing happening that didn't happen on my old PC when I'm mapping , If I create a solid , there's a diaganol white line through it now this also happens on my laptop , but it never happened on my old pc, can anyone explain this to me, also when I click on the solid , if there is another solid behind it , it doesn't select the solid I click on but instead the one in the back.

"Tools" ---> "Options..." ---> "3D views" and uncheck "Reverse selection order". That should take care of the selection-problem.
Speed
The default is usually ok but you might
want to make a fast or slow door.
Distance (deg)
How far your door opens, 90 degrees by default.
Usually this is correct.
Reverse Dir
Makes the door open in the other direction.
Same as using -90 instead of 90 for the distance
Passable
Makes the door non-solid, so you can't be blocked by it.
One Way
Makes the door only open one direction.
Otherwise you can push the door open from either side.
Toggle
The door will not close by itself,
you will have to use it again to close it.
Probably more realistic.
IMPORTANT said:
X Axis
Makes the door rotate around the X Axis.
Good for a trap door with the hinge on the North/South edge.
Y Axis
Makes the door rotate around the Y Axis.
Good for a trap door with the hinge on the East/West edge.
User
The first one sezamee. The middle one gets really boring. Is the organ supposed to have like a reverse effect on it? It seems a bit dodgy-sounding. Like... disconnected.
Could you please post a screenshot of the problem? I don't see how it can reverse the texture...
You can rotate the texture using the Texture Application but I don't think you can mirror it or even reverse it...
eDan Co. said:
Isn't there a flag to reverse the direction?

well yes but that makes it open towards the player so the direction again depends on the position of the pl... oh you mean if I tick both flags?
Hmmm... that could work, I'll have to try it out when I have the chance.
User
Isn't there a flag to reverse the direction?
User
In fact duck I made an other map where I built other doors and It still doesnt work. Help me to lead the texture in wally so I can mirror it. Then how do I load it in VHE to use it on the reverse of my door ?


thnx
User
Quote:
if you're outside and face the door and the knob is on the left side, when you're inside and facing the door the knob will be on the right side.


Thats what I meant srry. Plus Thats wha I mean to do

Quote:
If you want to apply a texture only to one face, bring up the 'texture application tool', with the 'texture application tool' still up, right-click on a brush-face in the 3D-window.

Which one is it (the one with the target or the one with diff texture on it) ?? Plus Ive tried them both, i cant right click my box to applay a diff texture on it. If I left click it paste it almost randomly, not considering the shape to fit to. Ill add a question. When ill be able to do that. how do I reverse the texture so it will do the "real world door".

I'd like to know if there is a way to "scroll" the texture on the brush like in Duke nukem map editor, so i can decide EACH face will show what I want from the texture.

Thanks a lot for your help




Truck
User
I know! I need to reverse the polarity! </crap joke>
Truck
User
melloyellow582 said:
You get a reverse medal.

What daya mean
Truck
You get a reverse medal.
Truck
User
FakeJer said:
Ooo.. Poor SRAW is getting framed...


Now SRAW is using reverse psychology.
User
i perfer the reverse cowboy or doggy style..


69 is always good.
Truck
User
It's part of your job as a boyfriend to worry and upset your girlfriend's parents*. It cannot be avoided. You'll have to live with it.

*This applies in reverse as well.
User
I use audacity to reverse mine.The guy cropped his stuff to make it sound better.
User
Connecting to //retortServer.

Connection accepted.

PRINT "Fuck you."

Connection lost.

"They asked me to do some reverse gardening while she hunted down her dad. This entailed throwing dead foliage on the ground and poorly constructing and leaving about bows."

I hope you liked it! <3

User
Administration has informed me that Desert Standard rules will apply here. However, a few high-tier non-enviroment specific destandardizations are in process. Last time we played a desert field there were combat bonuses awarded between quarters that let certain players or teams use weaponry or tactics not normally allowed in the game. Due to the fact that only one player managed to accrue enough bonus tallies* to open up any extra weapon slots, we've changed the rules a bit.

Strewn according to "Power-up Location Axiom VI" are the new and experimental "Bonus Hats." These hats are colored-coded and designed by Stetson to achieve a perfect level of comfort and effectiveness. These stylish new additions to Pole Socking will allow a various assortment of stat increases and weapon modifications as well as a few off the wall bonuses developed by our dreadful team of apothecaries. Here are a few examples of headwear you might discover while on the field:

Stat Increases:

Morale boosts
Armor Level increase +200
Regen VII
Skill Tree +3
+1 to Robot Design
Bachelor's Degree in Economics

Weapon Upgrades:

Firing speed +20%
Damage x 3 vs. Monsters and Pirates
Flesh to Stone Bullets/Rockets/Lasers/Rocket-Lasers
Ammo Capacity +50%
...and you may even earn rights to the control disc for the mighty satellite laser!

Other:

Airflow Reverse!
Mallet weight down 75%, impact stays the same!
900 yard diameter Rainstorm where caster chooses! (One use.)
Team Switch! (Your personal points come with you.)
Quad Damage!
There's also one hat that will reset all hats to new locations, including itself.

Remember, all bonus hats are unlabled and the only way to find out what they do is to adorn them. There are a few cursed hats that will hurt your stats or drain hp (or both!) and can only be removed by a level 24 cleric or higher. Bonus hats may be given to teammates or discarded at any time, you may only wear one hat at a time but can carry as many as you have room for.

Please Stand By.




*The good doctor Cryson's triple hurricane split helix assault in his dune buggy against the anti-tank helicopter wing of Blue Teamn last game, he managed to score 6,500 combat points in no more than 22 seconds while racking up 16 kills. Some fans were confused and upset about the "Deathbot Destructo" he was awarded for this feat of grand massacre but it was well within the tournament's rules.
User
All right, I got the memos in from R & D, and have weighed in the opinion of the Arbitrators, so I'm ready to reveal some of the established background behind this tournament.

* This tourney takes a sharp departure from the last one, selecting a desert setting to contrast the previous swamp one. This means that the terrain won't be in play vertically quite as much as last year, but there are added concerns.
Storm chasing is going to prove difficult here as the dust devils can whip up enough grating force to rend flesh from bones, so we're providing you with skinsuits that are resistant to this kind of enviroment. The downside is that the suits generate some heat on their own, while absorbing the natural heat of the enviroment, so you'll have to be sharp in your use of them or face the possibility of exhaustion.
Additionally, there are bands of Desert Nomads wandering around the course. Officially, they aren't in play, and haven't even been notified of the tourney. Hell, they probably haven't even seen an aluminum light-gauge hammer, let alone the higher-end alloys you can find on the market. But, if you can convince them to aid you, they can be used, just note that you cannot use them to engage in any sort of socking. Whatever you promise them is up to you, but they can't all be trusted or easily convinced.
There are other, more interesting field factors, but they're being kept lock and key right now.

* The favored transport for the tourney is marsupial. Don't worry: dune buggies are still active and present, in part because we can't afford to lose our sponsorships and in part because, well, what's a dune without a buggy? Regardless, marsupial transport techniques should be first and foremost in your focus, as double jumps, reverse tail socks, backdoor maneuvers, and leap socks are necessary given the the length and strength of the poles. This really isn't something you should overlook because base socks and top socks might not cut it with standard issue mallets.
To level the playing field a bit, biological and mechanical transport will be reduced to a purely aesthetic preference. The genetics crew really outdid themselves in this one, but keep in mind that no matter what you choose, you'll be limited to one piece of weaponry on the dominant shoulder and can only confiscate or commandeer other parts. Transportation cannot be equipped with two weapons simultaneously and you'll have no means to carry the spare, assuming you can find one to begin with.

* Resonance bombs will be limited to Level Three. Anything beyond that and they start accoustically interfering with the monotremic harmonics. Speaking of which, all bombs and vehicles are tuned to the standard frequency here, so you're not allowed to alter the harmonics this time, biological or otherwise. Everything is tuned right to the threshold and any variance thereof would either result in catastrophe or a null reaction.
That's part of the reason why we're limiting the r-bombs this time. Last run at this, we failed to factor this in and ended up with a ward over at the Veteran's Society who could do nothing but scream until their throats and lungs gave out. We can't afford to maintain that kind of upkeep right now, and the technology has only gotten more powerful since that time. Fuck around with this, and you'll probably end up dead in additional to disqualified.

* As an added twist, teams will not be officially established until the second quarter, when time grenades will start appearing in the enviroment. You will know what team you're assigned to by the color your time fractures manifest as once you throw the grenades. The pain of this is, we've generated only limited quantities of these grenades and you'll want to use them sparingly, so there's no sense in throwing one off and scratching it just to see what side you're on. Instead, you'll have to figure out whose side you're on during real-time combat and adjust your plans from there. Prior to that, you collaborate and work against each other at your own peril, and its up to your own discretion the degree to which you choose to involve yourself.

Finally, and I have to stress this, but there will be no fusion-based explosives. Precision will take precedence over brute force with explosives here. It's not just because fusion reactors make for highly-visible targets at night, but it's also because we attempted this in the test labs and the results were less than satisfactory. Not only did they generate a large fracture in the earth's surface, but they sent it back in time and sped up the continental drift by 14%. I'm not allowed to reveal anything more until the families and governments are notified, but we already have a scrub team on it to cover the tracks. I just pity the poor bastards that have to come home from that kind of job...

Anyway, those are the releases as they concern the players. The rest, you'll find out on the field.
User
You know what, fuck it.

Kill the potato. Come on, do it. Quit being such a pussy about it.

This is not reverse psychology.
User
oh yes reverse psychology. very interesting.